<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLvCargoTable extends Migration
{
    /**
     * 货源表
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cargos', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->string('loading_time', 11)->comment('装车时间');
            $table->unsignedInteger('user_id')->index('user_id')->comment('货主id');
            $table->string('start_addr')->comment('出发地');
            $table->string('end_addr')->comment('到达地');
            $table->string('receiver_name', 32)->comment('收货人姓名');
            $table->string('receiver_phone', 11)->comment('收货人手机号');
            $table->string('type', '32')->comment('货物类型');
            $table->unsignedInteger('weight')->comment('重量');
            $table->unsignedInteger('volume')->comment('体积');
            $table->unsignedInteger('car_lenght')->comment('车长');
            $table->string('car_type', 32)->comment('车型');
            $table->decimal('price')->comment('运费');
            $table->string('remark')->comment('备注');
            $table->tinyInteger('is_auto')->default(0)->comment('是否选择智能发货：0为不选择，1为智能发货');
            $table->tinyInteger('is_discuss')->default(0)->comment('是否协商:0为不选择协商，1为协商');
            $table->tinyInteger('is_common')->default(0)->comment('是否存为常用货源:0为否，1为是');
            $table->tinyInteger('is_visible')->default(1)->comment('是否同城可见：0为不可见，1为可见');
            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cargos');
    }
}
